package com.KOL;

import com.KOL.model.character.PlayerCharacter;
import com.KOL.present.ChunkDisplay;
import com.KOL.present.Section;
import com.KOL.present.game.CreationWindow;
import com.KOL.present.game.Game;
import com.KOL.present.game.GameWindow;
import com.util.ImagesLoader;

public class Main {
    public final static int DEFAULT_FPS = 40; // TODO: read from config file located in com.KOL
    private static final Section STARTING_SECTION = Section.ONEONE;
    private static final String IMG_INFO = "imgInfo.dat";
    private static final String SOUND_FILE = "soundInfo.dat";
    private ImagesLoader imsLoader;
    private ChunkDisplay chunk;

    public Main() {
        imsLoader = new ImagesLoader(IMG_INFO);
        chunk = new ChunkDisplay(imsLoader, STARTING_SECTION);
        long period = (long) 1000.0/DEFAULT_FPS;
        period = period * 1000000L;
        GameWindow window = new GameWindow(period);
        CreationWindow creationWindow = new CreationWindow(window);
        PlayerCharacter player = creationWindow.getPlayer(imsLoader, chunk);
        Game game = new Game(window, period, imsLoader, chunk, player);

        window.addPanel(game);
        game.requestFocus();
        
    }

    public static void main(String[] args) {
        new Main();
    }

}
